package com.bdilab.iot.service.impl;

import com.bdilab.iot.dao.PermissionMapper;
import com.bdilab.iot.model.Permission;
import com.bdilab.iot.service.PermissionService;
import com.bdilab.iot.utils.ParsePermissionUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author WangNing
 * @version 1.0
 * @date 2020/8/1 17:40
 */
@Service
@Slf4j
public class PermissionServiceImpl implements PermissionService {

    @Resource
    PermissionMapper permissionMapper;

    @Override
    public Map<String, Map<String, List<Permission>>> getAllPermission() {
        List<Permission> permissions = permissionMapper.getAllPermission();
        return  ParsePermissionUtils.parsePermission(permissions);
    }
}
